#include "voptionsbar.h"
#include <QPushButton>

VOptionsBar::VOptionsBar(QWidget* parent)
    : QWidget(parent)
    , m_pButtonChat(new QPushButton(this))
    , m_pButtonContact(new QPushButton(this))
{

   
    m_pButtonChat->setText("1");
    m_pButtonChat->move(0, 20);

    m_pButtonContact->setText("2");
    m_pButtonContact->move(0, 100);
    setFixedWidth(54);
    setAttribute(Qt::WA_StyledBackground, true);//默认Qwidget类 无法设置颜色
    setStyleSheet(R"(
        VOptionsBar
        {
            background-color: #2E2E2E; 
        }
     )");

    initConnect();
}

void VOptionsBar::initConnect()
{
    connect(m_pButtonChat, &QPushButton::released, this, &VOptionsBar::onOptionButtonReleased);
    connect(m_pButtonContact, &QPushButton::released, this, &VOptionsBar::onOptionButtonReleased);

}


void VOptionsBar::onOptionButtonReleased()
{
         if (sender() == m_pButtonChat)     emit optionSeleted(OPTIONS::CHAT);
    else if (sender() == m_pButtonContact)  emit optionSeleted(OPTIONS::CONTACT);
}
VOptionsBar::~VOptionsBar()
{}
